package com.dhl.college.service.edu.controller;

import com.dhl.college.common.base.result.R;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author dhl
 * @since 2020/11/08
 */
@CrossOrigin
@RestController
@RequestMapping("/user")
public class LoginController {

    /**
     * 登陆功能
     * @return
     */
    @PostMapping("/login")
    public R login(){
        return R.ok().data("token","admin");
    }

    /**
     * 获取用户信息功能
     * @return
     */
    @GetMapping("/info")
    public R info(){
        return R.ok()
                .data("name","admin")
                .data("roles","[admin]")
                .data("avatar","https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1604814910857&di=ddb77f4d60f6403e5a6f949e8a1ac892&imgtype=0&src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fitem%2F202009%2F24%2F20200924201441_xdhsp.thumb.400_0.jpeg");
    }

    /**
     * 退出功能
     * @return
     */
    @PostMapping("/logout")
    public R logout(){
        return R.ok();
    }
}
